Geometry types


In [1]:
#include <xthreejs/xbase.hpp>
#include <xthreejs/xcore.hpp>
#include <xthreejs/xgeometries.hpp>
#include <cmath>

In [2]:
xthree::box_geometry_generator()
    .width(5) 
    .height(10) 
    .depth(15)
    .widthSegments(5) 
    .heightSegments(10)
    .depthSegments(15)
    .finalize()


Out[2]:

In [3]:
xthree::circle_geometry_generator()
    .radius(10)
    .segments(10)
    .thetaStart(0.25)
    .thetaLength(5.0)
    .finalize()


Out[3]:

In [5]:
xthree::circle_buffer_geometry_generator()
    .radius(10)
    .segments(10)
    .thetaStart(0.25)
    .thetaLength(5.0)
    .finalize()


Out[5]:

In [6]:
xthree::cylinder_geometry_generator()
    .radiusTop(5)
    .radiusBottom(10)
    .height(15)
    .radiusSegments(6)
    .heightSegments(10)
    .openEnded(false) 
    .thetaStart(0) 
    .thetaLength(2.0*M_PI)
    .finalize()


Out[6]:

In [7]:
xthree::cylinder_buffer_geometry_generator()
    .radiusTop(5)
    .radiusBottom(10)
    .height(15)
    .radiusSegments(6)
    .heightSegments(10)
    .openEnded(false) 
    .thetaStart(0) 
    .thetaLength(2.0*M_PI)
    .finalize()


Out[7]:

In [10]:
xthree::dodecahedron_geometry_generator()
    .radius(10)
    .detail(0)
    .finalize()


Out[10]:

In [ ]:
// TODO:
// EdgesGeometry(...)

In [9]:
// TODO:
// ExtrudeGeometry(...)

In [9]:
xthree::icosahedron_geometry_generator()
    .radius(10)
    .finalize()


Out[9]:

In [11]:
xthree::lathe_buffer_geometry_generator()
    .segments(16)
    .phiStart(16)
    .phiLength(2.*M_PI)
    .points({{ 0, -10, 0},
             {10,  -5, 0},
             { 5,   5, 0},
             { 0,  10, 0}
            })
    .finalize()


Out[11]:

In [12]:
xthree::octahedron_geometry_generator()
    .radius(10)
    .detail(0)
    .finalize()


Out[12]:

In [13]:
xthree::parametric_geometry_generator()
    .func(R"(function(u,v) { 
        var x = 5 * (0.5 - u);
        var y = 5 * (0.5 - v);
        return new THREE.Vector3(10 * x, 10 * y, x*x - y*y); 
        })")
    .slices(5)
    .stacks(10)
    .finalize()


Out[13]:

In [14]:
xthree::plane_geometry_generator()
    .width(10)
    .height(15)
    .widthSegments(5)
    .heightSegments(10)
    .finalize()


Out[14]:

In [15]:
xthree::plane_buffer_geometry_generator()
    .width(10)
    .height(15)
    .widthSegments(5)
    .heightSegments(10)
    .finalize()


Out[15]:

In [16]:
// TODO
// PolyhedronGeometry(...)

In [17]:
// TODO: issues when radius is 0...
xthree::ring_geometry_generator()
    .innerRadius(10)
    .outerRadius(25)
    .thetaSegments(8)
    .phiSegments(12)
    .thetaStart(0)
    .thetaLength(2*M_PI)
    .finalize()


Out[17]:

In [18]:
// TODO: issues when radius is 0...
xthree::ring_buffer_geometry_generator()
    .innerRadius(10)
    .outerRadius(25)
    .thetaSegments(8)
    .phiSegments(12)
    .thetaStart(0)
    .thetaLength(6.283185307179586)
    .finalize()


Out[18]:

In [19]:
// TODO
// ShapeGeometry(...)

In [19]:
xthree::sphere_geometry_generator()
    .radius(20)
    .widthSegments(8)
    .heightSegments(6)
    .phiStart(0)
    .phiLength(1.5*M_PI)
    .thetaStart(0)
    .thetaLength(2.*M_PI/3)
    .finalize()


Out[19]:

In [20]:
xthree::sphere_buffer_geometry_generator()
    .radius(20)
    .widthSegments(8)
    .heightSegments(6)
    .phiStart(0)
    .phiLength(1.5*M_PI)
    .thetaStart(0)
    .thetaLength(2.*M_PI/3)
    .finalize()


Out[20]:

In [21]:
xthree::tetrahedron_geometry_generator()
    .radius(10)
    .detail(1)
    .finalize()


Out[21]:

In [19]:
// TODO: font loading
// TextGeometry(...)

In [22]:
xthree::torus_geometry_generator()
    .radius(20)
    .tube(5)
    .radialSegments(20)
    .tubularSegments(6)
    .arc(1.5*M_PI)
    .finalize()


Out[22]:

In [23]:
xthree::torus_buffer_geometry_generator()
    .radius(100)
    .finalize()


Out[23]:

In [24]:
xthree::torus_knot_geometry_generator()
    .radius(20)
    .tube(5)
    .radialSegments(8)
    .tubularSegments(64)
    .p(2)
    .q(3)
    .finalize()


Out[24]:

In [25]:
xthree::torus_knot_buffer_geometry_generator()
    .radius(20)
    .tube(5)
    .radialSegments(8)
    .tubularSegments(64)
    .p(2)
    .q(3)
    .finalize()


Out[25]:

In [27]:
// TODO: handling THREE.Curve
// NOT WORKING
xthree::tube_geometry_generator()
    .segments(64)
    .radius(1)
    .radiusSegments(8)
    .close(false)
    .finalize()


Out[27]:

In [28]:
xthree::wireframe_geometry_generator()
    .geometry(xthree::torus_buffer_geometry_generator()
        .radius(100)
        .tube(5)
        .radialSegments(6)
        .tubularSegments(20)
        .arc(2*M_PI)
        .finalize())
    .finalize()


Out[28]:

In [ ]: